Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing Custom Output File Naming for MDX, MDXC, and VR Models #141

Merged
merged 6 commits into from
Nov 3, 2024

Conversation

Bebra777228
Copy link
Contributor

@Bebra777228 Bebra777228 commented Nov 3, 2024

Hello!

I've implemented a feature to customize the output file names for MDX, MDXC, and VR models within the separate method. However, for the Demucs model, I've left the naming as is, as I'm not entirely sure how to implement this feature for it.
#128 (comment)

Here's an example of how to use the new functionality:

from audio_separator.separator import Separator

separator = Separator()
separator.load_model(model_filename='model_bs_roformer_ep_317_sdr_12.9755.ckpt')

output_files = separator.separate('music.mp3', 'primary_output_name', 'secondary_output_name')

print(f"Separation complete! Output file(s): {' '.join(output_files)}")

In this example, primary_output_name and secondary_output_name are the custom names that will be used for saving the output files. For instance, the files will be saved as primary_output_name.wav and secondary_output_name.wav.

You can also rename specific stems:

  • To rename the primary stem:

    output_files = separator.separate('music.mp3', primary_output_name='primary_output_name')
  • To rename the secondary stem:

    output_files = separator.separate('music.mp3', secondary_output_name='secondary_output_name')

Or do not rename the files:

output_files = separator.separate('music.mp3')

Screenshots:

Screenshot 03-11-2024 132049
Screenshot 03-11-2024 131602


I encourage you to test this update, as you have a better understanding of programming than I do. You may be able to find a solution to customize file names for the Demucs model and fix other possible problems if they occur.

@beveradb beveradb merged commit 85909ad into nomadkaraoke:main Nov 3, 2024
9 checks passed
@beveradb
Copy link
Collaborator

beveradb commented Nov 3, 2024

Nice one, thank you for making this addition!
It's an improvement I'll likely use in my own tooling 😄

Released in audio-separator version 0.24 onwards 🎉

@Bebra777228
Copy link
Contributor Author

Bebra777228 commented Nov 3, 2024

Demucs stopped working. 🤔

ERROR:root:Demucs separation failed: DemucsSeparator.separate() takes 2 positional arguments but 4 were given

I hadn't tested it before, I thought it would work fine, but no, it's giving errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants